package com.example.demo2.controller;

import com.example.demo2.generator.entity.R;
import com.example.demo2.generator.entity.Role;
import com.example.demo2.generator.service.RoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@Api (value = "RoleController",tags = "角色接口测试")
@RequestMapping("/Role")
public class RoleController {
    @Autowired
    private RoleService roleService;
    @ApiOperation("查询所有角色")
    @RequestMapping("/getAllRole")
    @ResponseBody
    public R getAllRole(){
        List<Role> roles = roleService.queryAllRole();
        return R.ok(roles);

    }

}
